//快乐数
public class isHappy {
    public boolean isHappy(int n) {
        int fast = operation(n);
        int slow = n;
        while(fast != slow){
            fast = operation(fast);
            fast = operation(fast);
            slow = operation(slow);
        }
        if(fast == 1){
            return true;
        }
        return false;
    }
    public int operation(int m){
        int ret = 0;
        while(m != 0){
            ret += (m%10) * (m%10);
            m /= 10;
        }

        return ret;
    }
}
